#include<iostream>
using namespace std;
int main()
{
	int sum=0,n;
	cin>>n; 
while(n)
{
	int x=n;
	while(x)
	{
      sum+=x%10;
      x/=10;
	}
	n--;

}
    cout<<sum<<endl;
    return 0;
}


